<template>
  <section>
    <!--工具条-->
    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-input v-model="filters.keyword" placeholder="关键字"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary"  v-on:click="toPageOne">查询</el-button>
        </el-form-item>
      </el-form>
    </el-col>

    <!--列表-->
    <el-table :data="departmentlogs" highlight-current-row v-loading="listLoading" style="width: 100%;">
      <el-table-column type="selection" width="100">
      </el-table-column>
      <el-table-column type="index" width="60">
      </el-table-column>
      <el-table-column prop="des" label="方法描述" width="200" >
      </el-table-column>
      <el-table-column prop="weyName" label="方法名称" width="120" >
      </el-table-column>
      <el-table-column prop="addressIp" label="ip" width="120" >
      </el-table-column>
      <el-table-column prop="executionTime" label="方法执行时间" width="200" >
      </el-table-column>


    </el-table>

    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <!--			<el-button type="danger" @click="batchRemove" :disabled="this.sels.length===0">批量删除</el-button>-->

      <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange"  style="float:right;"
                     :page-size="pageSize"
                     :current-page="currentPage"
                     :total="total">
      </el-pagination>
    </el-col>


  </section>
</template>

<script>

export default {
  data() {
    return {
      filters: {
        keyword: ''
      },
      departmentlogs: [],//系统记录数据
      total: 0,//总条数
      currentPage: 1,
      pageSize: 5,
      listLoading: false,
    }
  },
  methods: {

    //模糊查询
    toPageOne(){
      this.currentPage=1;
      this.getDepartmentlogs();
    },

    //当前页也改变
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getDepartmentlogs();
    },

    //获取系统记录列表
    getDepartmentlogs() {
      // 忙等开启
      this.listLoading = true;
      let para = {
        currentPage:this.currentPage,
        pageSize:this.pageSize,
        keyword:this.filters.keyword
      }
      this.$http.post("/dlog",para)
          .then(result=>{

            this.departmentlogs=result.data.rows;
            this.total=result.data.totals;
            // 忙等关闭
            this.listLoading = false;
          })
          .catch(result=>{
            this.$message({
              message: '网络不通！',
              type: 'error'
            });
          })
    },

  },
  mounted() {
    this.getDepartmentlogs();
  }
}

</script>

<style scoped>

</style>